import { _decorator, AudioSource, Component, instantiate, Node, UITransform } from 'cc';
import { AudioManager } from '../../../core/modules/audio/AudioManager';
import { ResManager } from '../../../core/modules/res/ResManager';
import { LoginAudio } from '../Login/LoginAudio';

const { ccclass, property } = _decorator;

@ccclass('LoginCtr')
export class LoginCtr extends Component {


    init(){
        //加载BGM后播放
        AudioManager.getInstance().playMusic(LoginAudio.bgm)
    }

    private m_OnLoginSuccess:Function = null;
    showLogin(onLoginSuccess: Function){
        this.m_OnLoginSuccess = onLoginSuccess;

        this.autoLogin()
    }

    autoLogin() {
        // 模拟登录耗时 1 秒回调实现（后续修改此为不同平台登录逻辑即可）
        setTimeout(() => {
            this.m_OnLoginSuccess();
        }, 1000)
    }
    
}


